/*
 * Copyright 2012 Marsrutai.lt
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package lt.marsrutai.mobile.android.model;

import java.util.Calendar;

import lt.marsrutai.mobile.android.model.enums.DateTime;
import lt.marsrutai.mobile.android.model.enums.TrackType;
import lt.marsrutai.mobile.android.model.enums.TransportType;
import android.os.Parcel;
import android.os.Parcelable;

public class ArrivalTime implements Parcelable {

    private TransportType transportType;
    private String transportId;
    private String scheduleId;
    private String scheduleName;
    
    private String trackId;
    private TrackType trackType;
    private String directionName;
    
    private String stopId;
    private String stopName;
    private String stopDirectionName;
    
    private String runId;
    private Boolean isAccessible;
    
    private Calendar scheduledTime;
    private Calendar expectedTime;

    
    

    public ArrivalTime() {
    }
    
    private ArrivalTime(Parcel in) {
        scheduledTime = new DateTime(in.readLong()).getCalendar();        
        expectedTime = new DateTime(in.readLong()).getCalendar();        
        scheduleId = in.readString();
        scheduleName = in.readString();
        trackId = in.readString();
        trackType = TrackType.parseEnum(in.readString());
        directionName = in.readString();
        stopDirectionName = in.readString();
        runId = in.readString();
        stopName = in.readString();
        stopId = in.readString();        
        isAccessible = in.readInt() == 1;
    }

    public static final Parcelable.Creator<ArrivalTime> CREATOR = new Parcelable.Creator<ArrivalTime>() {

        @Override
        public ArrivalTime createFromParcel(Parcel in) {
            return new ArrivalTime(in);
        }

        @Override
        public ArrivalTime[] newArray(int size) {
            return new ArrivalTime[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(scheduledTime.getTimeInMillis());
        dest.writeLong(expectedTime.getTimeInMillis());
        dest.writeString(scheduleId);
        dest.writeString(scheduleName);
        dest.writeString(trackId);
        dest.writeString(trackType.toString());
        dest.writeString(directionName);
        dest.writeString(stopDirectionName);
        dest.writeString(runId);
        dest.writeString(stopName);
        dest.writeString(stopId);      
        dest.writeInt(isAccessible ? 1 : 0);
    }
    
    public Calendar getScheduledTime() {
        return scheduledTime;
    }

    public void setScheduledTime(Calendar scheduledTime) {
        this.scheduledTime = scheduledTime;
    }

    public Calendar getExpectedTime() {
        return expectedTime;
    }

    public void setExpectedTime(Calendar expectedTime) {
        this.expectedTime = expectedTime;
    }

    public String getScheduleId() {
        return scheduleId;
    }

    public void setScheduleId(String scheduleId) {
        this.scheduleId = scheduleId;
    }

    public String getScheduleName() {
        return scheduleName;
    }

    public void setScheduleName(String scheduleName) {
        this.scheduleName = scheduleName;
    }

    public String getTrackId() {
        return trackId;
    }

    public void setTrackId(String trackId) {
        this.trackId = trackId;
    }

    public TrackType getTrackType() {
        return trackType;
    }

    public void setTrackType(TrackType trackType) {
        this.trackType = trackType;
    }

    public String getDirectionName() {
        return directionName;
    }

    public void setDirectionName(String directionName) {
        this.directionName = directionName;
    }

    public TransportType getTransportType() {
        return transportType;
    }

    public void setTransportType(TransportType transportType) {
        this.transportType = transportType;
    }
    
    public String getTransportId() {
        return transportId;
    }
    
    public void setTransportId(String transportId) {
        this.transportId = transportId;
    }

    public String getStopDirectionName() {
        return stopDirectionName;
    }

    public void setStopDirectionName(String stopDirectionName) {
        this.stopDirectionName = stopDirectionName;
    }

    public String getRunId() {
        return runId;
    }

    public void setRunId(String runId) {
        this.runId = runId;
    }

    public String getStopName() {
        return stopName;
    }

    public void setStopName(String stopName) {
        this.stopName = stopName;
    }

    public String getStopId() {
        return stopId;
    }

    public void setStopId(String stopId) {
        this.stopId = stopId;
    }

    public Boolean getIsAccessible() {
        return isAccessible;
    }

    public void setIsAccessible(Boolean isAccessible) {
        this.isAccessible = isAccessible;
    }

}
